import axios from '@/libs/api.request'
import { getToken } from '@/libs/util'
// =============== news-system/advertisements/list.vue =========================
let auth_token = getToken();
export const login = ({ username, password,client_id }) => {
  const data = {
    username,
    password,
    client_id
  }
  return axios.request({
    url: 'api/v1.cuser.login/index',
    data,
    method: 'post'
  })
}

export const getUserInfo = (token) => {
  return axios.request({
    url: 'api/v1.cuser.car_user/read',
    params: {
      auth_token:token
    },
    method: 'get'
  })
}
//编辑
export const saveUser = (formData) => {
	formData.auth_token = auth_token;
  return axios.request({
    url: 'api/v1.cuser.car_user/update',
    data:formData,
    method: 'post'
  })
}

//平台指南
export const getZn = (token) => {
  return axios.request({
    url: 'api/v1.cuser.index/car_user_zn',
    params: {
      auth_token:auth_token
    },
    method: 'get'
  })
}

//平台协议
export const getAgree = (token) => {
  return axios.request({
    url: 'api/v1.cuser.index/car_user_agree',
    params: {
      auth_token:auth_token
    },
    method: 'get'
  })
}

//隐私条款
export const getHide = (token) => {
  return axios.request({
    url: 'api/v1.cuser.index/hide',
    params: {
      auth_token:auth_token
    },
    method: 'get'
  })
}

//编辑
export const saveBack = (formData) => {
	formData.auth_token = auth_token;
  return axios.request({
    url: 'api/v1.cuser.car_user/back',
    data:formData,
    method: 'post'
  })
}

//修改密码
export const updatePassword = (formData) => {
	formData.auth_token = auth_token;
  return axios.request({
    url: 'api/v1.cuser.car_user/update_password',
    data:formData,
    method: 'post'
  })
}

//修改手机号获取验证码
export const updateAccountCode = (formData) => {
	formData.auth_token = auth_token;
  return axios.request({
    url: 'api/v1.common.cuser.sms/save_account_code',
    data:formData,
    method: 'post'
  })
}

//修改手机号
export const updateAccount = (formData) => {
	formData.auth_token = auth_token;
  return axios.request({
    url: 'api/v1.cuser.car_user/update_account',
    data:formData,
    method: 'post'
  })
}



export const logout = (token) => {
  return axios.request({
    url: 'api/v1.cuser.login/login_out',
    method: 'post'
  })
}
